﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using PaketTrackerVerwaltung.PaketTrackerServer;

namespace PaketTrackerVerwaltung
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void bttSuche_Click(object sender, RoutedEventArgs e)
        {
            if (txtIdent.Text.Length == 0)
            {
                MessageBox.Show("Bitte geben Sie eine Paket-Ident Nummer ein.");
                txtIdent.Focus();
                return;
            }

            PaketTrackerServer.WebservicesSoapClient client = new PaketTrackerServer.WebservicesSoapClient();
            PaketStatus status = client.GetPaketStatus(txtIdent.Text);

            if (status == null)
            {
                MessageBox.Show("Paket nicht gefunden, kein gültiger Paket-Ident");
                return;
            }


            Adresse wndAdresse = new Adresse();
            wndAdresse.Owner = this;
            wndAdresse.PaketIdent = txtIdent.Text;
            wndAdresse.ShowDialog();
        }

        private void txtIdent_TextChanged(object sender, TextChangedEventArgs e)
        {

        }
    }
}
